#!./bin/python
# ----------------------------------------------------------------------
# Relink lib/pythonX.X to lib/python
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------

# Python modules
import os
import shutil
from distutils.sysconfig import get_python_lib


def main():
    sp_path = get_python_lib()
    pv = sp_path.split(os.sep)[-2]
    pl_path = os.path.join("lib", "python")
    if not os.path.exists(pl_path):
        os.chdir("lib")
        shutil.move(pv, "python")
        os.symlink("python", pv)
        print("CHANGED")
    else:
        print("OK")

if __name__ == "__main__":
    main()
